//package com.shuziren.service.scheduled;
//
//import com.shuziren.pojo.entity.InterviewSchedule;
//import com.shuziren.service.InterviewScheduleService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import java.text.SimpleDateFormat;
//import java.util.Date;
//import java.util.List;
//import java.util.concurrent.Executors;
//import java.util.concurrent.ScheduledExecutorService;
//import java.util.concurrent.TimeUnit;
//
//@Service
//public class AiTaskService {
//    @Autowired
//    private InterviewScheduleService interviewScheduleService;
//    private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(10);
//
//    public void scheduleInterviewTask(Date interviewTime) {
//        // 格式化日期
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        String formattedInterviewTime = sdf.format(interviewTime);
//
//        long delay = interviewTime.getTime() - System.currentTimeMillis();
//        if (delay > 0) {
//            scheduler.schedule(() -> {
//                InterviewSchedule interviewSchedule = new InterviewSchedule();
//                interviewSchedule.setStatus(5);
//                interviewScheduleService.updateInterviewSchedule(interviewSchedule);
//            }, delay, TimeUnit.MILLISECONDS);
//        }
//    }
//}